package gupao.concurrency.datasync.controller;

import gupao.concurrency.datasync.entity.TciWordData;
import gupao.concurrency.datasync.mapper.TciWordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/tci")
public class TciController {

    @Autowired
    private TciWordMapper tciWordMapper;

//    @RequestMapping("/insert")
//    public String insert(){
//        TciWordData word = TciWordData.builder()
//                .bidword("abc")
//                .comp(8L)
//                .cost(8L)
//                .click(8L)
//                .cpc(8L)
//                .ctr(1.0F)
//                .cvr(8.0F)
//                .build();
//        ArrayList<TciWordData> collection = new ArrayList<>();
//        collection.add(word);
//        collection.add(word);
//        int x = tciWordMapper.insert(collection);
//        return String.valueOf(x);
//    }

    @RequestMapping("/query/{id}")
    public TciWordData findOne(@PathVariable  Long id){
        return tciWordMapper.findById(id);
    }
}
